<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui">

	<h:form id="edit">
		<h:panelGrid columns="2" style="margin:5px" >
			<h:outputText value="Local:" />
			<p:inputText required="true" value="#{placeMB.place.local}" />
			<h:outputText/>
			<p:commandButton value="Inserir" action="#{placeMB.insert}" process="@form" update="@form :contentForm:list" />			
		</h:panelGrid>
	</h:form>
	<h:form id="list">
		<p:dataTable id="listValues" var="p" value="#{placeMB.values}" selectionMode="single" selection="#{placeMB.selected}" rowKey="#{p.id}">
			<f:facet name="header">
				Locais de Entrega
			</f:facet>		
			<p:ajax event="rowSelect" listener="#{placeMB.onRowSelected}" />
			<p:column headerText="ID" style="width:30px">
				<h:outputText value="#{p.id}" />
			</p:column>
			<p:column headerText="Valor" >
				<h:outputText value="#{p.local}" />
			</p:column>
			<p:column headerText="#" style="width:100px" >
				<p:commandButton value="Remover" action="#{placeMB.delete(p)}" process="@form" update="@form" />
			</p:column>
		</p:dataTable>
	</h:form>
</html>